//
//  MKOrderObject.m
//  YangDongXi
//
//  Created by cocoa on 15/4/16.
//  Copyright (c) 2015年 cocoa. All rights reserved.
//

#import "MKOrderObject.h"


@implementation MKOrderObject

+ (NSDictionary *)propertyAndKeyMap
{
    return @{
             @"pickupTime":@"pickup_time",
             @"orderUid" : @"order_uid",
             @"orderSn" : @"order_sn",
             @"orderItems" : @"order_item_list",
             @"isInvoice" : @"is_invoice",
             @"userMemo" : @"user_memo",
             @"orderStatus" : @"order_status",
             @"totalPrice" : @"total_price",
             @"deliveryFee" : @"delivery_fee",
             @"totalAmount" : @"total_amount",
             @"deliveryInfo" : @"delivery_info_list",
             @"paymentInfo" : @"order_payment",
             @"discountInfo" : @"order_discount_list",
             @"couponItems" : @"coupon_list",
             @"wealthItems" : @"wealth_account_list",
             @"paymentId" : @"payment_id",
             @"deliveryId" : @"delivery_id",
             @"orderTime" : @"order_time",
             @"payTime" : @"pay_time",
             @"consignTime" : @"consign_time",
             @"receiptTime" : @"receipt_time",
             @"orderItemSource" : @"source_type",
             @"storesObject":@"store_uid",
             @"store":@"order_store",
             @"consignee":@"consignee",
             @"activityInfo":@"activity_info",
             @"requireTimeShow" : @"requireTimeShow",
             @"deliveryMan" : @"delivery_man",
             @"totalAddTax" : @"addTax",
             @"isOverSea" : @"isOverSea"
             
             };
}

+ (Class)classForArrayItemWithName:(NSString *)propertyName andIndex:(NSInteger)index
{
    if ([propertyName isEqualToString:@"orderItems"])
    {
        return [MKOrderItemObject class];
    }
    if ([propertyName isEqualToString:@"deliveryInfo"])
    {
        return [MKDeliveryInfo class];
    }
    if ([propertyName isEqualToString:@"store"]) {
        return [MKInformationObject class];
    }
    if ([propertyName isEqualToString:@"discountInfo"])
    {
        return [MKOrderDiscountObject class];
    }
    if ([propertyName isEqualToString:@"couponItems"])
    {
        return [MKCouponObject class];
    }
    
    if ([propertyName isEqualToString:@"wealthItems"])
    {
        return [MKWealthAcountInfo class];
    }
    return nil;
}


+ (NSString *)textForStatus:(MKOrderStatus)status
{
    return @{@(MKOrderStatusSellerCancel) : @" ",
             @(MKOrderStatusUnpaid)         : @"待付款" ,
             @(MKOrderStatusCanceled)       : @"无效单" ,
             @(MKOrderStatusPaid)           : @"待发货" ,
             @(MKOrderStatusDeliveried)     : @"待收货" ,
             @(MKOrderStatusSignOff)        : @"待评价" ,
             @(MKOrderStatusAppraised)      : @"已评价" ,
             @(MKOrderStatusRefundApply)    : @"退款中" ,
             @(MKOrderStatusRefundFinished) : @"退款完成",
             @(MKOrderStatusGoodsFailed)    : @"收货失败",
             @(MKOrderStatusRefundRefund)   : @"卖家拒绝退款",
             @(MKOrderStatusRefundGoods)    : @"卖家拒绝退货",
             @(MKOrderStatusOrderEnd)       : @"订单结束"}[@(status)];
}

@end
